import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import androidx.viewpager2.adapter.FragmentStateAdapter
import com.ruoyi.app.fragment.CommonLoginFragment
import com.ruoyi.app.fragment.PhoneLoginFragment

class ViewPagerAdapter(fragmentActivity: FragmentActivity) :
    FragmentStateAdapter(fragmentActivity) {

    override fun getItemCount(): Int = 2 // Tab 数量

    override fun createFragment(position: Int): Fragment {
        return when (position) {
            0 -> CommonLoginFragment()
            1 -> PhoneLoginFragment()
            else -> throw IllegalArgumentException()
        }
    }
}